import { request } from 'umi';

//----------------------------------------------------------------------------

export async function queryAdmin(params) {
  var data = await request('/api/admin/loadAll', {
    method: 'POST',
    data: { ...params },
  });
  return data.data;
}

export async function removeAdmin(params) {
  return request('/api/admin/delAdmin', {
    method: 'POST',
    data: { ...params },
  });
}

export async function addAdmin(params) {
  return request('/api/admin/addAdmin', {
    method: 'POST',
    data: { ...params },
  });
}

export async function updateAdmin(params) {
  return request('/api/admin/updateAdmin', {
    method: 'POST',
    data: { ...params },
  });
}

export async function queryProduct(params) {
  var data = await request('/api/product/loadAll', {
    method: 'POST',
    data: { ...params },
  });
  return data.data;
}

export async function updateProduct(params) {
  return request('/api/product/modifyProduct', {
    method: 'POST',
    data: { ...params },
  });
}

export async function addProduct(params) {
  return request('/api/product/saveProduct', {
    method: 'POST',
    data: { ...params },
  });
}

export async function removeProduct(params) {
  console.log(params);
  return request('/api/product/delProduct', {
    method: 'POST',
    data: { ...params },
  });
}

export async function queryOrder(params) {
  var data = await request('/api/t-order/loadAll', {
    method: 'POST',
    data: { ...params },
  });
  return data.data;
}

export async function queryrefund(params) {
  var data = await request('/api/refund/loadAll', {
    method: 'POST',
    data: { ...params },
  });
  return data.data;
}

export async function queryChannel(params) {
  var data = await request('/api/channel/loadAll', {
    method: 'POST',
    data: { ...params },
  });
  return data.data;
}

export async function removeChannel(params) {
  return request('/api/channel/delChannel', {
    method: 'POST',
    data: { ...params },
  });
}

export async function addChannel(params) {
  console.log(params);
  return request('/api/channel/addChannel', {
    method: 'POST',
    data: { ...params },
  });
}

export async function updateChannel(params) {
  console.log(params);
  return request('/api/channel/updateChannel', {
    method: 'POST',
    data: { ...params },
  });
}

export async function queryBrand(params) {
  var data = await request('/api/brand/loadAll', {
    method: 'POST',
    data: { ...params },
  });
  return data.data;
}

export async function removeBrand(params) {
  return request('/api/brand/delBrand', {
    method: 'POST',
    data: { ...params },
  });
}

export async function addBrand(params) {
  return request('/api/brand/addBrand', {
    method: 'POST',
    data: { ...params },
  });
}

export async function updateBrand(params) {
  return request('/api/brand/updateBrand', {
    method: 'POST',
    data: { ...params },
  });
}

export async function queryApi(params) {
  var data = await request('/api/ApiDetails/loadApis', {
    method: 'POST',
    data: { ...params },
  });
  return data.data;
}

export async function updateApi(params) {
  var data = await request('/api/ApiDetails/updateApi', {
    method: 'POST',
    data: { ...params },
  });
  return data.data;
}

export async function removeApi(params) {
  var data = await request('/api/ApiDetails/delApi', {
    method: 'POST',
    data: { ...params },
  });
  return data.data;
}

export async function addApi(params) {
  var data = await request('/api/ApiDetails/addApi', {
    method: 'POST',
    data: { ...params },
  });
  return data.data;
}
